{template Public:Page:header}
<div class="container">
  <div class="row"> 
  {template Member:Index:sidebar}
    <div class="col-lg-10 well-col-pl-30">
    <form id="ChangePasswordForm">
      <div class="row">
        <div class="well">
          <h3>修改密码</h3>
          <hr />

                <br />
                 <div class="row">
                <div class="col-lg-5 col-sm-offset-1">
               		 <div class="form-group">
                            <input name="passwordold" type="password" class="form-control"  placeholder="原密码"/>    
                     </div>
                     
                     <div class="form-group">
                          <input type="password" placeholder="新密码" data-bv-notempty-message="<i class='fa fa-frown-o'></i> 对不起！请输入创建密码！" data-bv-notempty="true"    data-bv-stringlength-message="<i class='fa fa-frown-o'></i> 对不起！密码格式有误,密码长度小于6位大于32位！" data-bv-stringlength-max="32" data-bv-stringlength-min="6" data-bv-stringlength="true" data-bv-regexp-message="<i class='fa fa-frown-o'></i>对不起！请输入英文字母与数字或符号组合！" data-bv-regexp-regexp="^[0-9a-zA-Z\_\@\#$\%\^\&\*\!\~]+$" data-bv-regexp="true"  name="password" class="form-control" data-bv-field="password" value="">   
                     </div>
                                   
                     <div class="form-group">
                            <input name="confirmPassword" type="password" class="form-control"  placeholder="验证密码"/>    
                     </div>
                     
                      <div class="form-group has-feedback">
                       
                                  <div class="progress progress-bordered">
                                           <div style="width: 0%" class="progress-bar"></div>
                                 </div>
                     
                        </div>
                   
                    <div class="form-group">
                            <button class="btn btn-palegreen" type="submit">确 认</button>
                 		    <input name="Submit" type="hidden" value="1"/>
                    </div>     
                </div>                          
                </div>

        </div>
      </div>
      </form>
      
    </div>
  </div>
</div>



<script src="{echo AURL}/js/validation/bootstrapValidator.js"></script>

<script>

        $(document).ready(function () {

 		  $('#ChangePasswordForm').bootstrapValidator({
                excluded: [':disabled'],
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
				fields: {
							
					passwordold:{
						 validators: {
							 notEmpty: {
								message: '<i class="fa fa-frown-o"></i> 对不起！请输入原密码！'
							}
						 }
					},
					
					 password:{
						 validators: {
							  notEmpty: {
								message: '<i class="fa fa-frown-o"></i> 对不起！请输入新密码！'
							 },
							 callback: {
								callback: function(value) {
						
									if(value.length<10 && value.match(/^[0-9]+$/)){
										$(".progress-bar").html('密码太简单');
										$(".progress-bar").css("width","20%");
									}
									
									if(value.length<10 && value.match(/^[a-zA-Z]+$/)){
										console.log($(".progress-bar").html());
										$(".progress-bar").html('密码简单');
										$(".progress-bar").css("width","40%");
									}
									
									if(value.length<10 && value.length>=6 && value.match(/[0-9]{1,20}/) && value.match(/[a-z]{1,20}/i)){
										 $(".progress-bar").html('密码强度一般');
										 $(".progress-bar").css("width","60%");
									}
									
									if(value.length>=10 && value.match(/[0-9]{1,10}/) && value.match(/[a-z]{1,10}/) && value.match(/[A-Z]{1,10}/)){
										 $(".progress-bar").html('密码强度良好');
										 $(".progress-bar").css("width","80%");
									}
									
									if(value.length>=10 && value.match(/[0-9]{1,10}/) && value.match(/[a-z]{1,10}/) && value.match(/[A-Z]{1,10}/) && value.match(/[\_\@\#\$\%\^\&\*\!\~]{1,10}/)){
										 $(".progress-bar").html('密码强度强');
										 $(".progress-bar").css("width","90%");
									}
									
																	
									if(value.length>=10 && value.match(/[0-9]{1,10}/) && value.match(/[a-z]{1,10}/) && value.match(/[A-Z]{1,10}/) && value.match(/[\_\@\#\$\%\^\&\*\!\~]{3,10}/)){
										 $(".progress-bar").html('密码强度超强');
										 $(".progress-bar").css("width","100%");
									}
								
									 return true;
	
								}
							}
						 }
					},
		
					confirmPassword:{
						 validators: {
							 notEmpty: {
								message: '<i class="fa fa-frown-o"></i> 对不起！请输入验证密码！'
							},
							identical: {
								field: 'password',
								message: '<i class="fa fa-frown-o"></i> 对不起！您输入验证密码不一致！'
							}
						 }
					},
				},
                submitHandler: function (form) {

				  $.post('{echo U("/post/password/change")}',$("#ChangePasswordForm").serialize(), function(json) {
					
					  	$('.bootbox').PhpappProgress({json:json});

				 		return true;
					
				  }, 'json');
				  

				 bootbox.dialog({
					 message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
					 title: '<i class="icon fa fa-retweet"></i> 提交中',
					 closeButton: false
				 }).PhpappProgress({time:5000});
			 
				  return false; 
				 
                } 
			
            }) 

        });
	   

</script>

{template Public:Page:footer}